# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         homework01
# Description:
# Author:       ASUS
# Date:         2019/3/7
#-------------------------------------------------------------------------------


zhsh_dict = {
    '1到99': [],
    '100到999': [],
    '1000到1999': [],
}
# 获取质数
zhsh = []
def get_zhsh(start,end):
    leap = 1
    for i in range(start, end):
        k = int(i / 2) + 1
        for j in range(2, k):
            if (i % j == 0):
                leap = 0
                break
        if leap:
            zhsh.append(i)                           #引用传递
        leap = 1
# 按区间计算质数
def zhshu(zhsh_dict):
    for i in zhsh:
        if i<100:
            zhsh_dict['1到99'].append(i)              #引用传递
        elif i>100 and i<1000:
            zhsh_dict['100到999'].append(i)
        else:
            zhsh_dict['1000到1999'].append(i)
# 测试代码
if __name__ == '__main__':
    get_zhsh(1,2000)
    zhshu(zhsh_dict)
    for key in zhsh_dict.keys():
        print(key,":",zhsh_dict[key])
